package com.yuanzong.wuliu.controller.admin.system.notice;

import com.yuanzong.wuliu.common.vo.ApiResult;
import com.yuanzong.wuliu.controller.admin.system.notice.param.*;
import com.yuanzong.wuliu.service.admin.system.notice.AdminSystemNoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@Api(tags = "管理端 - 公告")
@RequestMapping("/admin/system/notice/systemNotice")
@Slf4j
public class AdminSystemNoticeController {

    @Autowired
    private AdminSystemNoticeService adminSystemNoticeService;

    @ApiOperation("分页")
    @RequestMapping(value = "/page", method = {RequestMethod.POST})
    public ApiResult page(@RequestBody AdminSystemNoticePageParam param) throws Exception {
        ApiResult result = adminSystemNoticeService.page(param);
        return result;
    }

    @ApiOperation("添加")
    @RequestMapping(value = "/add", method = {RequestMethod.POST})
    public ApiResult add(@Valid @RequestBody AdminSystemNoticeAddParam param) throws Exception {
        ApiResult result = adminSystemNoticeService.add(param);
        return result;
    }

    @ApiOperation("修改")
    @RequestMapping(value = "/modify", method = {RequestMethod.POST})
    public ApiResult modify(@Valid @RequestBody AdminSystemNoticeModifyParam param) throws Exception {
        ApiResult result = adminSystemNoticeService.modify(param);
        return result;
    }

    @ApiOperation("详情")
    @RequestMapping(value = "/info", method = {RequestMethod.POST})
    public ApiResult info(@RequestBody AdminSystemNoticeInfoParam param) throws Exception {
        ApiResult result = adminSystemNoticeService.info(param);
        return result;
    }

    @ApiOperation("删除")
    @RequestMapping(value = "/remove", method = {RequestMethod.POST})
    public ApiResult remove(@RequestBody AdminSystemNoticeRemoveParam param) throws Exception {
        ApiResult result = adminSystemNoticeService.remove(param);
        return result;
    }
}
